﻿using Microsoft.Practices.Prism.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace WebServerConnectorDll
{
    [DataContract]
    public class CCity : NotificationObject, IFruitClass
    {
        private bool isChoose;
        private int uid;
        private String name;
        private int provinceUID;
        private String provinceName;

        public bool IsChoose
        {
            get
            {
                return isChoose;
            }
            set
            {
                isChoose = value;
                RaisePropertyChanged("IsChoose");
            }
        }

        [DataMember(Order = 0)]
        public int UID
        {
            get
            {
                return uid;
            }
            set
            {
                uid = value;
                RaisePropertyChanged("UID");
            }
        }

        [DataMember(Order = 1)]
        public String Name
        {
            get
            {
                return name;
            }
            set
            {
                name = value;
                RaisePropertyChanged("Name");
            }
        }

        [DataMember(Order = 2)]
        public int ProvinceUID
        {
            get
            {
                return provinceUID;
            }
            set
            {
                provinceUID = value;
                RaisePropertyChanged("ProvinceUID");
            }
        }

        [DataMember(Order = 3)]
        public String ProvinceName
        {
            get
            {
                return provinceName;
            }
            set
            {
                provinceName = value;
                RaisePropertyChanged("ProvinceName");
            }
        }

        public CCity(int pUID,String pName, int pProvinceUID)
        {
            UID = pUID;
            Name = pName;
            ProvinceUID = pProvinceUID;
        }

        public String ToInsertString()
        {
            return UID + "-\'" + Name + "\'-" + ProvinceUID;
        }

        public String ToUpdateString()
        {
            return "UID=" + UID + ",Name=\'" + Name + "\',ProvinceUID=" + ProvinceUID;
        }
    }
}

